$(document).ready(function(){
	$("#section_watcher div").first().show();
	$('.single-slider').jRange({
	    from: 3,
	    to: 12,
	    step: 3,
	    scale: [3,6,9,12],
	    format: '%s days',
	    width: 150,
	    showLabels: true,
	    onstatechange : function(value){chartImg(value)}
	});
	
});

//쇼핑몰별 가격정보
$(document).delegate("a[id^='inflowInfo_']", "click", function(e) {
	e.preventDefault();
	$("#pricetabs a").each(function(){
		$(this).removeClass("on");
		$(this).addClass("off");
	});
	$(this).removeClass("off");
	$(this).addClass("on");
	
	$("#section_watcher div.yui3-g").hide();
	$("#section_watcher div."+this.id).show();
	
});

//쇼핑몰별 가격정보
$(document).delegate("input[id^='price_type_']", "click", function(e) {
	$("#c_inflowProductSeq").val($(':radio[name="siteType"]:checked').val());
	chartImg($(".single-slider").val());
});

 
//희망 가격 수정
$(document).delegate("button[id^='update_Price_']", "click", function(e) {
	e.preventDefault();
	var inflowProductSeq = this.id.split("_")[2];
	alert("가격수정 추후 작업");
	//$.blockUI(); 
});

//희망 가격 삭제
$(document).delegate("button[id^='delete_Price_']", "click", function(e) {
	e.preventDefault();
	alert("가격삭제 추후 작업");
});


//차트이미지 노출
function chartImg(month) { 
	var baseProductSeq = $("#c_baseProductSeq").val();
	var inflowProductSeq = $("#c_inflowProductSeq").val();
	var inflowImgUrl =  "/jChar/view.png?baseProductSeq=" +baseProductSeq+"&inflowProductSeq=" + inflowProductSeq+"&month="+month;
	$("#chartImg").attr("src",inflowImgUrl)
} 
		
function changePriceAjax(inflowProductSeq, price) { 
	 $.ajax({
       type : "get",
       // URL 주소를 설정합니다.
       url : "/prod/updateInflowProduct.json",
       data : {
       	"inflowProductSeq" : inflowProductSeq,
       	"price" : price
       },
       success : function (data) {
       	location.reload();
       }, error:function(e){  
       	console.log(e.responseText);  
       } 
   });
} 